#include "physics.h"
#include "../core/engine/world.h"
#include "../core/engine/engine.h"

namespace sleek
{
    namespace node
    {
        namespace physics
        {
            /** ***************************** **/
            Physics::Physics(core::engine::engine *mgr) : smgr(mgr), world(mgr->getPhysics()), geom(0)
            {
                smgr->getWorld()->waitPhysics();
            }
            Physics::~Physics()
            {
                smgr->getWorld()->waitPhysics();
                if(geom) delete geom;
            }
            /** ***************************** **/
            void Physics::setUserData(void *a)
            {
                userdata = a;
            }
            void Physics::setType(body_type type)
            {
                btyp = type;
            }
            void Physics::setRotation(core::math::vector3df a)
            {
                rot = a;
            }
            void Physics::setMass(core::f32 i)
            {
            }
            void Physics::setFriction(core::f32 i)
            {
                friction = i;
            }
            void Physics::setDensity(core::f32 i)
            {
                density = i;
            }
            void Physics::setGeometry(mesh::MeshBuffer *a)
            {
                geom = a;
            }
            void Physics::setRestitution(core::f32 i)
            {
                restitution = i;
            }
            void Physics::setPosition(core::math::vector3df a)
            {
                pos = a;
            }
            /** ***************************** **/
            core::math::vector3df Physics::getPosition()
            {
                return pos;
            }
            core::f32 Physics::getRestitution()
            {
                return restitution;
            }
            mesh::MeshBuffer* Physics::getGeometry()
            {
                return geom;
            }
            core::f32 Physics::getDensity()
            {
                return density;
            }
            core::f32 Physics::getFriction()
            {
                return friction;
            }
            core::f32 Physics::getMass()
            {
                return density;
            }
            core::math::vector3df Physics::getRotation()
            {
                return rot;
            }
            btRigidBody* Physics::getPhysics()
            {
                return body;
            }
            body_type Physics::getType()
            {
                return btyp;
            }
            void* Physics::getUserData()
            {
                return userdata;
            }
            /** ***************************** **/
        }
    }
}
